package simplejson

func (j *_Json)Foreach(cb func(int,string, Json)bool){
	if(j.IsArray()){
		for i:=0;i<j.ArrayLen();i++{
			cb(i,"",j.GetByIndex(i))
		}
	}else{
		m,ok := j.data.(map[string]interface{})
		if ok{
			idx:=0
			for k,v:=range m{
				if !cb(idx,k,&_Json{data:v}){
					break
				}
				idx++
			}
		}
	}

}
